<?php
/*
+--------------------------------------------------------------------------
|   WeCenter [#RELEASE_VERSION#]
|   ========================================
|   by WeCenter Software
|   © 2011 - 2014 WeCenter. All Rights Reserved
|   http://www.wecenter.com
|   ========================================
|   Support: WeCenter@qq.com
|
+---------------------------------------------------------------------------
*/

define('IN_AJAX', TRUE);


if (!defined('IN_ANWSION')) {
    die;
}

class ajax extends AWS_CONTROLLER
{
//	public function get_access_rule()
//	{
//		$rule_action['rule_type'] = 'white'; //黑名单,黑名单中的检查  'white'白名单,白名单以外的检查
//
//		$rule_action['actions'] = [
//			'check_username',
//			'check_email',
//			'register_process',
//			'login_process',
//			'register_agreement',
//			'send_valid_mail',
//			'valid_email_active',
//			'request_find_password',
//			'find_password_modify',
//			'weixin_login_process',
//			'check_mobile',
//			'sendmsg'
//		];
//
//		return $rule_action;
//	}

    public function search_action()
    {
        $result = $this->model('search')->search(cjk_substr($_GET['q'], 0, 64), 'users', 1, $_GET['limit'], $_GET['topic_ids'], $_GET['is_recommend']);

        if (!$result)
        {
            $result = array();
        }else{
            foreach ($result as $k => $v) {
                $result_uids[] = $v['uid'];
            }
            $result = $this->model('account')->get_user_info_by_uids($result_uids, true);
        }

//        if ($_GET['is_question_id'] AND is_digits($_GET['q']))
//        {
//            $question_info = $this->model('question')->get_question_info_by_id($_GET['q']);
//
//            if ($question_info)
//            {
//                $result[] = $this->model('search')->prase_result_info($question_info);
//            }
//        }
        TPL::assign('friend_list', $result);
        TPL::output('friend/ajax/friend');
//        H::ajax_json_output($result);
    }


}
